package vip.xiaonuo.smzq.modular.kcl.controller;

import javax.annotation.Resource;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import vip.xiaonuo.smzq.modular.kcl.entity.Ckqbg;
import vip.xiaonuo.smzq.modular.kcl.service.ICkqbgService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.validation.annotation.Validated;
import vip.xiaonuo.common.pojo.CommonResult;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;


/**
 * 采矿权变更表
 *
 * @author sqq
 * @since 2024-04-21
 */
@Api(tags = "采矿权变更表")
@RestController
@RequestMapping("/kcl/ckqbg")
@Validated
public class CkqbgController {

    @Resource
    private ICkqbgService iCkqbgService;

    /**
     * 添加采矿权变更表
     */
    @ApiOperation("添加采矿权变更表")
    @PostMapping("/add")
    public CommonResult<String> add(@RequestBody @Valid Ckqbg ckqbg) {
        iCkqbgService.save(ckqbg);
        return CommonResult.ok();
    }

    /**
     * 删除采矿权变更表
     */
    @ApiOperation("删除采矿权变更表")
    @PostMapping("/delete")
    public CommonResult<String> delete(@ApiParam(name = "pkid", value = "主键") @RequestParam String pkid) {
        iCkqbgService.removeById(pkid);
        return CommonResult.ok();
    }

    /**
     * 编辑采矿权变更表
     */
    @ApiOperation("编辑采矿权变更表")
    @PostMapping("/edit")
    public CommonResult<String> edit(@RequestBody @Valid Ckqbg ckqbg) {
        iCkqbgService.updateById(ckqbg);
        return CommonResult.ok();
    }

    /**
     * 采矿权变更表分页查询
     */
    @ApiOperation("采矿权变更表分页查询")
    @GetMapping("/list")
    public CommonResult<Page<Ckqbg>> page() {
        return CommonResult.data(iCkqbgService.page(new Ckqbg()));
    }
}
